package priv.pront.code.national.acwing.math;

import java.util.Collections;
import java.util.Scanner;
import java.util.ArrayList;

public class A869_试除法求约数 {
    static int n;

    static void isYueShu(int n) {
        ArrayList<Integer> lis = new ArrayList<>();
        for (int i = 1; i <= n / i; ++i) {
            if (n % i == 0) {
                lis.add(i);
                if (n / i != i) lis.add(n / i);
            }
        }
        Collections.sort(lis, (a, b) -> a - b);
        for (int c : lis) {
            System.out.print(c + " ");
        }
        System.out.println();
    }

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        while (n-- != 0) {
            int a = sc.nextInt();
            isYueShu(a);
        }
    }
}
